function generateAvatarSVG(text = '') {
  const displayText = text ? text.charAt(0).toUpperCase() : 'U';
  const hue = Math.floor(Math.random() * 360);
  const saturation = 70;
  const lightness = 80;
  
  const svg = `
    <svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
      <rect width="200" height="200" fill="hsl(${hue}, ${saturation}%, ${lightness}%)" />
      <text x="100" y="100" font-size="100" font-weight="bold" font-family="Arial" 
            fill="#333333" text-anchor="middle" dominant-baseline="middle">
        ${displayText}
      </text>
    </svg>
  `;

  return `data:image/svg+xml;base64,${Buffer.from(svg).toString('base64')}`;
}

module.exports = {
  generateAvatarSVG
}; 